version: '3.8'

services:
  manticore:
    build:
      context: ./.docker/manticore
      dockerfile: Dockerfile
    container_name: wapinet-manticore
    ports:
      - "9306:9306" # mysql adapter
    ulimits:
      nproc: 65535
      nofile:
        soft: 65535
        hard: 65535
      memlock:
        soft: -1
        hard: -1
    volumes:
      - '.docker/manticore/manticore.conf:/etc/manticoresearch/manticore.conf'
      - '.docker/manticore/data:/var/lib/manticore'
  mysql:
    build:
      context: ./.docker/mysql
      dockerfile: Dockerfile
    command: [--default-authentication-plugin=mysql_native_password, --innodb-use-native-aio=0, --skip-mysqlx]
    container_name: wapinet-mysql
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ALLOW_EMPTY_PASSWORD=yes
      - MYSQL_PASSWORD=passwoRt
      - MYSQL_USER=wapinet
      - MYSQL_DATABASE=wapinet
    volumes:
      - '.docker/mysql/data:/var/lib/mysql'
      - '.docker/mysql/server.cnf:/etc/mysql/conf.d/server.cnf'

  php:
    build:
      context: ./.docker/php
      dockerfile: Dockerfile
    volumes:
      - '.:/var/www/app'
      - '.docker/php/php.ini:/usr/local/etc/php/php.ini'
      - '.docker/php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini'
    container_name: wapinet-php
    ports:
      - "9000:9000" # php-fpm
    depends_on:
      - mysql
    expose:
      - "9001" # xdebug

  nginx:
    build:
      context: ./.docker/nginx
      dockerfile: Dockerfile
    volumes:
      - '.:/var/www/app'
      - '.docker/nginx/app.conf:/etc/nginx/conf.d/default.conf'
    ports:
      - "80:80"
    container_name: wapinet-nginx
    depends_on:
      - php